$z-index-tour-tips-backdrop: 1250;

.tour-tip {
    display: flex;

    &__box {
        &.tippy-box {
            padding: 18px 24px 24px;
            border: 1px solid rgba(var(--center-channel-color-rgb), 0.16);
            background: var(--button-bg);
            border-radius: var(--radius-s);
            color: var(--button-color);
            filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.12));

            a {
                color: rgba(var(--button-color-rgb), 0.8);

                &:hover {
                    color: var(--button-color);
                    text-decoration: underline;
                }
            }

            .tippy-content {
                padding: 0;
            }

            .tippy-arrow {
                width: 12px;
                height: 12px;
                border-color: rgba(var(--center-channel-color-rgb), 0.16);
                color: var(--center-channel-bg);
                color: var(--center-channel-bg);
            }

            .tippy-arrow::before {
                width: 12px;
                height: 12px;
                border-color: rgba(var(--center-channel-color-rgb), 0.16);
                background: var(--button-bg);
                color: var(--button-color);
                transform-origin: center;
            }

            button[class^='StyledChip-'],
            button[class*='StyledChip-'] {
                color: var(--button-color);
                background-color: rgba(var(--button-color-rgb), 0.08);
                box-shadow: none;
                margin: 0 8px 8px 0;

                &:hover {
                    background-color: rgba(var(--button-color-rgb), 0.16);
                }
            }

            .btn {
                &.btn-primary {
                    background: var(--button-color);
                    color: var(--button-bg) !important;

                    &:hover:not(.disabled) {
                        background:
                            linear-gradient(
                                0deg,
                                rgba(var(--button-bg-rgb), 0.08) 0%,
                                rgba(var(--button-bg-rgb), 0.08) 100%),
                                var(--button-color);
                    }

                    &:active {
                        background:
                            linear-gradient(
                                0deg,
                                rgba(var(--button-bg-rgb), 0.16) 0%,
                                rgba(var(--button-bg-rgb), 0.16) 100%),
                                var(--button-color);
                    }

                    &:focus {
                        box-shadow: inset 0 0 0 2px var(--sidebar-text-active-border);
                    }
                }

                &.btn-tertiary {
                    background: rgba(var(--button-color-rgb), 0.08);
                    color: var(--button-color);

                    &:hover {
                        background: rgba(var(--button-color-rgb), 0.12);
                    }

                    &:active {
                        background: rgba(var(--button-color-rgb), 0.16);
                    }

                    &:focus {
                        box-shadow: inset 0 0 0 2px var(--sidebar-text-active-border);
                    }
                }

                &.btn-icon {
                    margin-right: -8px;
                    margin-left: 1.2rem;
                    color: rgba(var(--button-color-rgb), 0.64);

                    &:hover {
                        background: rgba(var(--button-color-rgb), 0.08);
                        color: rgba(var(--button-color-rgb), 0.8);
                    }

                    &.active {
                        background: rgba(var(--button-color-rgb), 0.16);
                    }
                }
            }

            // fix for https://mattermost.atlassian.net/browse/MM-41711. This covers the current placements we use for the channels and other tools tour
            &[data-placement^=right] > .tippy-arrow {
                transform: translate3d(0, 14px, 0) !important;
            }

            &[data-placement^=top] > .tippy-arrow {
                transform: translate3d(14px, 0, 0) !important;
            }

            &[data-placement^=bottom] > .tippy-arrow {
                transform: translate3d(14px, 0, 0) !important;
            }

            &[data-placement=bottom-end] > .tippy-arrow {
                transform: translate3d(317px, 0, 0) !important;
            }
        }
    }

    &__pulsating-dot-ctr {
        position: absolute;
        z-index: 3;
        width: 14px;
        height: 14px;
        cursor: pointer;
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=top] {
        top: 0;
        left: calc(50% - 6px);
        transform: translate(0, 6px);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=top-start] {
        top: 0;
        left: 0;
        transform: translate(6px, 6px);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=top-end] {
        top: 0;
        right: 0;
        transform: translate(-6px, 6px);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=bottom] {
        bottom: 0;
        left: calc(50% - 6px);
        transform: translate(0, -6px);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=bottom-start] {
        bottom: 0;
        left: 0;
        transform: translate(6px, -6px);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=bottom-end] {
        right: 0;
        bottom: 0;
        transform: translate(-6px, -6px);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=left] {
        top: calc(50% - 6px);
        left: 0;
        transform: translate(6px, 0);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=left-start] {
        top: 0;
        left: 0;
        transform: translate(6px, 6px);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=left-end] {
        bottom: 0;
        left: 0;
        transform: translate(6px, -6px);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=right] {
        top: calc(50% - 6px);
        right: 0;
        transform: translate(-6px, 0);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=right-start] {
        top: 0;
        right: 0;
        transform: translate(-6px, 6px);
    }

    &__pulsating-dot-ctr[data-pulsating-dot-placement=right-end] {
        right: 0;
        bottom: 0;
        transform: translate(-6px, -6px);
    }

    &__overlay {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }

    &__header {
        display: flex;
        align-items: center;
        justify-content: flex-start;

        &__title {
            flex: none;
            flex-grow: 1;
            order: 0;
            margin: 0;
            font-family: inherit;
            font-size: 1.4rem;
            font-style: normal;
            font-weight: 600;
            line-height: 2rem;
        }

        .Tag {
            margin-left: 4px;
        }
    }

    &__body {
        display: flex;
        flex-direction: column;
        margin-top: 0.6rem;

        p,
        div {
            margin: 0 0 0.8rem;
            font-size: 1.4rem;
            line-height: 2rem;

            &:last-child {
                margin-bottom: 0;
            }
        }
    }

    &__body:last-child {
        margin-bottom: 0;
    }

    &__image {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: 2.4rem;
        border-radius: var(--radius-s);

        img {
            width: 100%;
            height: 136px;
            border-radius: var(--radius-s);
            object-fit: cover;
        }
    }

    &__btn-ctr {
        display: flex;
        flex-grow: 1;
        justify-content: flex-end;
    }

    &__dot-ctr {
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    &__dot-ring {
        position: relative;
        display: flex;
        width: 12px;
        height: 12px;
        align-items: center;
        justify-content: center;
        margin-right: 4px;
        background: transparent;
        border-radius: var(--radius-full);

        &:last-child {
            margin-right: 0;
        }
    }

    &__dot-ring-active {
        background: rgba(var(--button-color-rgb), 0.16);
    }

    &__dot {
        position: absolute;
        top: 3px;
        left: 3px;
        width: 6px;
        height: 6px;
        background: rgba(var(--button-color-rgb), 0.32);
        border-radius: var(--radius-full);

        &.active {
            background: rgba(var(--button-color-rgb), 1);
        }
    }

    &__footer {
        display: flex;
        flex-direction: column;
        margin-top: 2.4rem;

        &-buttons {
            display: flex;
            align-items: center;
            justify-content: start;
        }
    }

    &__opt {
        align-self: flex-end;
        margin-top: 1.2rem;
        font-size: 12px;

        span {
            opacity: 0.9;
        }
    }

    &__backdrop {
        position: absolute;
        z-index: $z-index-tour-tips-backdrop;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);

        &--transparent {
            background: none !important;
        }
    }
}

// adding important as temporary fix, will be removing tippy very soon (WIP)
.tippy-box[data-placement^=right] > .tippy-arrow::before {
    top: -1px !important;
    border-width: 1px 0 0 1px !important;
    transform: rotate(-45deg) !important;
}

.tippy-box[data-placement^=left] > .tippy-arrow::before {
    top: -1px !important;
    border-width: 1px 1px 0 0 !important;
    transform: rotate(45deg) !important;
}

.tippy-box[data-placement^=bottom] > .tippy-arrow::before {
    left: 1px !important;
    border-width: 1px 0 0 1px !important;
    transform: rotate(45deg) !important;
}

.tippy-box[data-placement^=top] > .tippy-arrow::before {
    left: 1px !important;
    border-width: 0 0 1px 1px !important;
    transform: rotate(-45deg) !important;
}
